using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Beetle;

internal class g
{
	public static DateTime a;

	public bool b;

	public string c;

	public string d;

	public int e;

	public DateTime f;

	private static g m_g;

	private static object m_h;

	internal static string i;

	private static string[] m_j;

	private static string[] k;

	private static string l;

	private static string m;

	private static StreamReader n;

	private static string o;

	static g()
	{
		global::g.a = DateTime.Now;
		global::g.m_g = null;
		global::g.m_h = null;
		global::g.i = "73HWrM6iCrk=";
		global::g.m_h = new RSACryptoServiceProvider(2048);
	}

	public static byte[] g(byte[] A_0)
	{
		return ((RSACryptoServiceProvider)global::g.m_h).Encrypt(A_0, fOAEP: false);
	}

	public static byte[] a(byte[] A_0)
	{
		return ((RSACryptoServiceProvider)global::g.m_h).Decrypt(A_0, fOAEP: false);
	}

	public static bool a(string A_0, string A_1)
	{
		return a(Encoding.UTF8.GetBytes(A_0), Convert.FromBase64String(A_1));
	}

	public static bool a(byte[] A_0, byte[] A_1)
	{
		return ((RSACryptoServiceProvider)global::g.m_h).VerifyData(A_0, "MD5", A_1);
	}

	private static void i(string A_0)
	{
		global::g.m_j = A_0.Split(new char[2] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
	}

	private static void h(string A_0)
	{
		k = Encoding.UTF8.GetString(Convert.FromBase64String(A_0)).Split(';');
	}

	private static void j()
	{
		global::g.m_g.c = k[0];
		global::g.m_g.d = k[1];
	}

	private static void i()
	{
		global::g.m_g.e = int.Parse(k[2]);
		global::o.a = int.Parse(k[2]);
		global::g.m_g.f = new DateTime(long.Parse(k[3]));
		y.e = global::g.m_g.f > global::g.a;
	}

	private static void a(string A_0, g A_1)
	{
		i(A_0);
		if (a(global::g.m_j[0], global::g.m_j[1]))
		{
			h(global::g.m_j[0]);
			j();
			i();
			A_1.b = A_1.f > global::g.a;
		}
	}

	private static void h()
	{
		n = new StreamReader(o);
	}

	private static void g(string A_0)
	{
		o = TcpUtils.h() + l;
	}

	private static void a(string A_0)
	{
		((RSACryptoServiceProvider)global::g.m_h).FromXmlString(m);
	}

	public static g g()
	{
		lock (typeof(g))
		{
			if (global::g.m_g == null)
			{
				global::g.m_g = new g();
				try
				{
					global::m.a(out m, out l);
					a((string)null);
					g(m);
					h();
					using (n)
					{
						a(n.ReadToEnd(), global::g.m_g);
					}
				}
				catch (Exception)
				{
				}
			}
		}
		y.c = global::g.m_g.b;
		return global::g.m_g;
	}

	private int a()
	{
		return e;
	}

	public bool a(Action<n> A_0, n A_1, int A_2, out int A_3)
	{
		A_3 = a();
		if (b)
		{
			return A_2 <= e;
		}
		return false;
	}
}
